<template>
  <div style="width: 350px">
    <el-form label-width="100px" :model="formData" :disabled="false">
      <el-form-item label="请输入密码：" prop="pass">
        <el-input v-model="formData.password" show-password ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" :disabled="okToPay" @click="paying">支 付</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import {payMoney} from '@/api/user'

export default {
  //支付窗口
  name: "pay",
  props:["orderNum","openPay"],
  data() {
    return {
      formData: {
        password: undefined,
      },
      okToPay: true
    }
  },
  watch: {
    'formData.password': function () {
        this.okToPay = this.formData.password.length <8
      }
  },
  methods: {
    paying() {
      payMoney(this.orderNum,this.formData.password).then((response) =>{
        alert(response.message);
        this.openPay = false;
        location.href = "/User_Portal/orderlist"
      })
    }
  }
}
</script>

<style scoped>

</style>
